package com.campuscarbooking.api.dto;

import com.campuscarbooking.api.model.Driver;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.math.BigDecimal;

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DriverDTO {
    private Long id;
    private String name;
    private String phone;
    private BigDecimal rating;
    private BigDecimal currentLocationLat;
    private BigDecimal currentLocationLng;
    private String workStatus;

    public static DriverDTO fromEntity(Driver driver) {
        if (driver == null) {
            return null;
        }

        DriverDTO dto = new DriverDTO();
        dto.setId(driver.getId());
        dto.setName(driver.getName());
        dto.setPhone(driver.getPhone());
        dto.setRating(driver.getRating());
        dto.setCurrentLocationLat(driver.getCurrentLocationLat());
        dto.setCurrentLocationLng(driver.getCurrentLocationLng());
        dto.setWorkStatus(driver.getWorkStatus().name());

        return dto;
    }
} 